package com.example.studentcoursesysteam.Repository;

import com.example.studentcoursesysteam.Bean.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Repository
public interface StudentRepository extends JpaRepository<Student,Integer> {

    boolean existsByCode(String code);
    List<Student> findByCodeAndPassword(String code,String password);
    List<Student> findByCode(String code);
    @Modifying
    @Transactional
    @Query(value = "delete from student where code =:code",nativeQuery = true)
    Integer getDeleteByCode(String code);


}
